package com.mali.backendcommon.config;


import com.mali.backendcommon.properties.AliOssProperties;
import com.mali.backendcommon.properties.EmailProperties;
import com.mali.backendcommon.util.AliOssUtil;
import com.mali.backendcommon.util.EmailUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class EmailConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public EmailUtil emailUtil(EmailProperties emailProperties)
    {
        log.info("开始创建emailUtil工具类对象,参数为{}",emailProperties);
        return new EmailUtil(emailProperties.getHost(),
                emailProperties.getPort(),
                emailProperties.getUserName(),
                emailProperties.getPassword(),
                emailProperties.getIsAuth(),
                emailProperties.getIsTls());
    }


}
